home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / highlight / highlight-W32GUI-2.2-10b-Setup.exe / {app} / src / elementstyle.cpp < prev    next >
C/C++ Source or Header  |  2004-10-21  |  2KB  |  84 lines

  1. /***************************************************************************
  2.                           elementstyle.cpp  -  description
  3.                              -------------------
  4.     begin                : Son Nov 10 2002
  5.     copyright            : (C) 2002 by AndrΘ Simon
  6.     email                : andre.simon1@gmx.de
  7.  ***************************************************************************/
  8.  
  9. /***************************************************************************
  10.  *                                                                         *
  11.  *   This program is free software; you can redistribute it and/or modify  *
  12.  *   it under the terms of the GNU General Public License as published by  *
  13.  *   the Free Software Foundation; either version 2 of the License, or     *
  14.  *   (at your option) any later version.                                   *
  15.  *                                                                         *
  16.  ***************************************************************************/
  17.  
  18. #include "elementstyle.h"
  19.  
  20. namespace highlight {
  21.  
  22. ElementStyle::ElementStyle(StyleColour col, bool b, bool i, bool u)
  23.     : colour(col) , bold(b), italic(i), underline(u)
  24. {}
  25.  
  26. ElementStyle:: ElementStyle(const string & elementStyleString)
  27.   : bold(false), italic(false), underline(false)
  28. {
  29.   set(elementStyleString);
  30. }
  31.  
  32. ElementStyle::ElementStyle()
  33.     : bold(false), italic(false), underline(false)
  34. {}
  35.  
  36. void ElementStyle::set(const string & elementStyleString){
  37.  
  38.   istringstream valueStream(elementStyleString.c_str());
  39.   string r, g, b, attr;
  40.   valueStream >> r;
  41.   valueStream >> g;
  42.   valueStream >> b;
  43.   colour.setRedValue(r);
  44.   colour.setGreenValue(g);
  45.   colour.setBlueValue(b);
  46.   while ( valueStream >> attr)
  47.     {
  48.       if (attr=="italic")
  49.         {
  50.           italic = true;
  51.         }
  52.       else if (attr=="bold")
  53.         {
  54.           bold = true;
  55.         }
  56.       else if (attr=="underline")
  57.         {
  58.           underline = true;
  59.         }
  60.     }
  61. }
  62.  
  63. ElementStyle::~ElementStyle()
  64. {}
  65.  
  66. bool ElementStyle::isItalic() const
  67. {
  68.   return italic;
  69. }
  70. bool ElementStyle::isBold() const
  71. {
  72.   return bold;
  73. }
  74. bool ElementStyle::isUnderline() const
  75. {
  76.   return underline;
  77. }
  78. StyleColour ElementStyle::getColour() const
  79. {
  80.   return colour;
  81. }
  82.  
  83. }
  84.